package com.hqyj.onlineExamination.modules.exam.dao;

import com.hqyj.onlineExamination.modules.exam.entity.Answer;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface AnswerDao {

    //新增
    @Insert("insert into exam_answer (create_date,achievement_id, question_id, user_answer) " +
            "values (#{createDate},#{achievementId},#{questionId},#{userAnswer})")
    void insertAnswer(Answer answer);

    //查询
    @Select("select * from exam_answer where achievement_id = #{achievementId}")
    List<Answer> getAnswersByAchievementId(int achievementId);
}
